package sjtu.rfid.rri.services.leaf.model;

import java.io.Serializable;

/**
 * Configuration of connection
 * 
 * @author jinghao
 * 
 */
public class ConnectionConfig implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3901622346696577526L;

	private String serverTranspType;
	private String serverTranspID;
	private String serverTranspParams;
	private String clientTranspType;
	private String clientTranspID;
	private String clientTranspParams;

	/**
	 * @return the serverTranspType
	 */
	public String getServerTranspType() {
		return serverTranspType;
	}

	/**
	 * @param serverTranspType
	 *            the serverTranspType to set
	 */
	public void setServerTranspType(String serverTranspType) {
		this.serverTranspType = serverTranspType;
	}

	/**
	 * @return the serverTranspID
	 */
	public String getServerTranspID() {
		return serverTranspID;
	}

	/**
	 * @param serverTranspID
	 *            the serverTranspID to set
	 */
	public void setServerTranspID(String serverTranspID) {
		this.serverTranspID = serverTranspID;
	}

	/**
	 * @return the serverTranspParams
	 */
	public String getServerTranspParams() {
		return serverTranspParams;
	}

	/**
	 * @param serverTranspParams
	 *            the serverTranspParams to set
	 */
	public void setServerTranspParams(String serverTranspParams) {
		this.serverTranspParams = serverTranspParams;
	}

	/**
	 * @return the clientTranspType
	 */
	public String getClientTranspType() {
		return clientTranspType;
	}

	/**
	 * @param clientTranspType
	 *            the clientTranspType to set
	 */
	public void setClientTranspType(String clientTranspType) {
		this.clientTranspType = clientTranspType;
	}

	/**
	 * @return the clientTranspID
	 */
	public String getClientTranspID() {
		return clientTranspID;
	}

	/**
	 * @param clientTranspID
	 *            the clientTranspID to set
	 */
	public void setClientTranspID(String clientTranspID) {
		this.clientTranspID = clientTranspID;
	}

	/**
	 * @return the clientTranspParams
	 */
	public String getClientTranspParams() {
		return clientTranspParams;
	}

	/**
	 * @param clientTranspParams
	 *            the clientTranspParams to set
	 */
	public void setClientTranspParams(String clientTranspParams) {
		this.clientTranspParams = clientTranspParams;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		if (null != serverTranspType) {
			sb.append(serverTranspType);
			sb.append(":");
			sb.append(serverTranspID);
			if (null != serverTranspParams) {
				sb.append(";");
				sb.append(serverTranspParams);
			}
		}
		if (null != clientTranspType) {
			if (null != serverTranspType) {
				sb.append("##");
			}
			sb.append(clientTranspType);
			sb.append(":");
			sb.append(clientTranspID);
			if (null != clientTranspParams) {
				sb.append(";");
				sb.append(clientTranspParams);
			}
		}
		return sb.toString();
	}

}
